//
//  LogisticsViewController.m
//  PigMarket
//
//  Created by 张敬 on 2019/8/19.
//  Copyright © 2019年 pigmarket.oc. All rights reserved.
//

#import "LogisticsViewController.h"
#import "LogisticsHeader.h"
#import "LogisticsCell.h"


@interface LogisticsViewController()

/**
 headerView
 */
@property (nonatomic , strong) LogisticsHeader *headerView;


@end


@implementation LogisticsViewController

#pragma mark - view life cycle

#pragma mark - init method
- (void)setupUI {
    
    {
        self.baseNavView.navTitleLabel.text = @"冷链物流";
        self.baseNavView.navTitleLabel.textColor = KWhiteColor;
        self.baseNavView.backgroundColor = KClearColor;
        self.baseNavView.line.hidden = YES;
    }
    
    {
        [self.baseNavView.leftNavBtn setImage:[UIImage imageNamed:@"nav_white"] forState:UIControlStateNormal];
        [self.headerView addSubview:self.baseNavView];
    }
    
    {
        [self.view addSubview:self.headerView];
    }
    
}



- (void) setupLayout {
    
    self.tableView.mj_y = self.headerView.bottom;
}



- (void)initData {
//    NSNumber *memberId = [UserInfoDataProvider sharedInstance].userInfo.memberId;
//    @weakify(self);
//    [[[PigMarketApi sharedInstance] getMyAssetWithMemberId:memberId] subscribeNext:^(MyAsset * _Nullable myAsset) {
//        @strongify(self);
//        self.model = [[MyAsset alloc] init];
//        self.model = myAsset;
//        self.headerView.balance.text = [NSString stringWithFormat:@"￥%@",self.model.money];
//        [self.myTableView reloadData];
//    } error:^(NSError * _Nullable error) {
//        @strongify(self);
//        [self handlingError:error];
//    }];
}



#pragma mark - delegate

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    
    return 5;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 102;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    LogisticsCell *cell = [tableView  dequeueReusableCellWithIdentifier:@"LogisticsCell"];
    cell.type = indexPath.row == 0 ?LogisticsCellType_Finish :LogisticsCellType_Doing;
    return cell;
}


- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    
}


#pragma mark - getter and setter

- (void)registerTableViewCell
{
    self.tableView.height = KScreenHeight - self.headerView.height;
    [self.tableView registerClass:[LogisticsCell class] forCellReuseIdentifier:@"LogisticsCell"];
}


- (LogisticsHeader *)headerView {
    
    if (!_headerView) {
        _headerView = [[LogisticsHeader alloc] init];
    }
    return _headerView;
}


@end
